package com.ib.webapp.controller;

import com.ib.model.Account;
import com.ib.model.Simulator;
import com.ib.service.GenericManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by USER on 12/18/14.
 */
@Controller
@RequestMapping("/simulators*")
public class SimulatorController extends BaseFormController {
    private GenericManager<Simulator, Long> simulatorManager;

    @Autowired
    public void setSimulatorManager(@Qualifier("simulatorManager") GenericManager<Simulator, Long> simulatorManager) {
        this.simulatorManager = simulatorManager;
    }

    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView handleRequest()
            throws Exception {
        return new ModelAndView().addObject(simulatorManager.getAll());
    }
}
